package sctu.edu.java.year2016.team01.renxinpeng.day20160526.chapter8_3;

/**
 * Created by Zero on 2016/5/25.
 * 尝试创建一个父类和子类，分别创建构造方法，然后向父类和子类添加成员变量
 * 和方法，并总结构建子类对象时的顺序。
 */
public class Family {
    public static void main(String[] args){


        Son rectangle=new Son(8,7);
        System.out.println("矩形的宽是："+rectangle.width);
        System.out.println("矩形的长是："+rectangle.length);



    }
}


//父类
class Father {

    int length;
    int width;


    public Father(int length, int width) {
        this.length = length;
        this.width = width;

    }


    public int getLength() {
        return length;
    }

    public int getWidth() {
        return width;
    }
}

    //子类
    class Son extends Father {

        public Son(int length, int width) {

            super(length, width);
        }

    }
